/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Imprimibles;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.PdfWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Padre {

    protected static StringBuffer sb = new StringBuffer();
    protected Document documento = new Document();
    private static final String pathPDF = "./src/LectorPDF/SumatraPDF.exe";
    private static final File file = new File(pathPDF);

    protected void crearPDF() {
        try {
            PdfWriter.getInstance(documento, new FileOutputStream("tempImprimible.pdf"));
        } catch (DocumentException de) {
            System.err.println(de.getMessage());
        } catch (IOException ioe) {
            System.err.println(ioe.getMessage());
        }
    }
    
    protected void cerrarPDF(){
        documento.close();
    }
    
    protected void formatoImprimible(){}
    
    public  void imprimir(File archivo){
        try {
            Process p = Runtime.getRuntime().exec(""+file.getAbsolutePath()+" "+archivo.getAbsolutePath()+"");
        } catch (IOException ex) {
            Logger.getLogger(Padre.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
